Loading data in constructors and not in constructors [JAVA]
Posted
by Richeve S. Bebedor
on Stack Overflow
See other posts from Stack Overflow
or by Richeve S. Bebedor
Published on 2010-06-08T13:19:38Z
Indexed on
2010/06/08
13:22 UTC
Read the original article
Hit count: 294
java
i just want to know the difference between loading the data inside the constructor and loading the data outside the constructor but not inside any methods
example: Loading inside constructor
public class Model{
Object testobject;
public Model(){
testobject=new Object();
}
}
VS
example: Loading outside constructor
public class Model{
Object testobject=new Object();
public Model(){
}
}
© Stack Overflow or respective owner